﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="MyDoneTracks.aspx.cs" Inherits="VO.Web.MyDoneTracks" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>
    My done tracks
</h2>
<asp:GridView ID="gvMyDoneTracks" runat="server" AutoGenerateColumns="False" 
        DataSourceID="odsMyDoneTracks" >
    <Columns>
        <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" 
            Visible="False" />
        <asp:BoundField DataField="TrackId" HeaderText="TrackId" Visible="False"
            SortExpression="TrackId" />
        <asp:TemplateField HeaderText="Track Name" >
            <ItemTemplate>
            <%# Eval("Track.TrackName")%>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Track Category" >
            <ItemTemplate>
            <%# Eval("Track.TrackCategory.CategoryName")%>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="UserId" HeaderText="UserId" SortExpression="UserId" 
            Visible="False" />
        <asp:BoundField DataField="ClubId" HeaderText="ClubId" SortExpression="ClubId" 
            Visible="False" />
        <asp:BoundField DataField="StartTime" 
            DataFormatString="{0: dd/MM/yyyy HH:mm:ss}" HeaderText="StartTime" 
            SortExpression="StartTime">
        <ItemStyle HorizontalAlign="Center" />
        </asp:BoundField>
        <asp:BoundField DataField="EndTime" DataFormatString="{0: dd/MM/yyyy HH:mm:ss}" 
            HeaderText="EndTime" SortExpression="EndTime">
        <ItemStyle HorizontalAlign="Center" />
        </asp:BoundField>
        <asp:BoundField DataField="CompletedTime" HeaderText="CompletedTime" Visible="False"
            SortExpression="CompletedTime" />
        <asp:TemplateField HeaderText="Completed Time" SortExpression="CompletedTime" ItemStyle-HorizontalAlign="Center">
            <ItemTemplate>
            <%# GetCompletedTime((long)Eval("CompletedTime")) %>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Valid" SortExpression="IsValid" ItemStyle-HorizontalAlign="Center">
            <ItemTemplate>
                <asp:Image ID="imgValidity" ImageUrl='<%# (bool)Eval("IsValid") ? "~/images/icon-valid-track-24.png" : "~/images/icon-invalid-track-24.png" %>' runat="server" />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="PostedDate" DataFormatString="{0: dd/MM/yyyy}" 
            HeaderText="PostedDate" SortExpression="PostedDate">
        <ItemStyle HorizontalAlign="Center" />
        </asp:BoundField>
        <asp:TemplateField HeaderText="Details" ItemStyle-HorizontalAlign="Center">
            <ItemTemplate>
            <a href='<%# Page.ResolveUrl("~/donetracks") + "/" + Eval("Id").ToString().Replace("-", string.Empty) %>' target="_blank">
                <asp:Image ID="imgTrackDetails" ImageUrl="/images/map-icon-16.png" runat="server" BorderWidth="0" />
            </a>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>

    <asp:ObjectDataSource ID="odsMyDoneTracks" runat="server" 
        SelectMethod="GetUserTracksDones" 
        TypeName="VO.Business.Controllers.TracksDonesController">
        <SelectParameters>
            <asp:SessionParameter Name="userId" SessionField="UserId" Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>

</asp:Content>
